﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UMLTouch.Core.UI;
using System.Collections.ObjectModel;
using System.Windows.Ink;
using System.Collections.Specialized;

namespace UMLTouch.UI.Start.ViewModels
{
    public class DiagramContextViewModel
    {
       

        IDiagramContext _diagramContext;

        public String DisplayName
        {
            get
            {
               return _diagramContext.Name;
            }
        }


        public DiagramItemsCollection DiagramItems
        {
            get { return _diagramContext.DiagramItems; }
        }

        public StrokeCollection Strokes { get; protected set; }

        public DiagramContextViewModel(IDiagramContext diagramContext)
        {
           
            _diagramContext = diagramContext;
            Strokes = new StrokeCollection();
            Strokes.StrokesChanged += new StrokeCollectionChangedEventHandler(Strokes_StrokesChanged);

          
        }

        void Strokes_StrokesChanged(object sender, StrokeCollectionChangedEventArgs e)
        {
            foreach (var stroke in e.Added)
            {
                UMLTouch.Core.Entities.Stroke s = new UMLTouch.Core.Entities.Stroke(stroke);
                _diagramContext.InputStroke(s);
            }
        }
    }
}
